#pragma once

#include <irrlicht.h>
#include "driverChoice.h"

#include "EventManger.h"

#include "Sphere.h"
#include "Plane.h"
#include "LightUnit.h"

#include "CollisionSolving.h"

#define VER "v0.0.1"

#ifdef _MSC_VER
#pragma comment( lib, "Irrlicht.lib" )
#endif

#define GRAVITY 0.2f

using namespace irr;

// Globals
extern IrrlichtDevice       *g_Device;
extern EventManager			*g_EventManager;
extern video::IVideoDriver  *g_Driver;
extern scene::ISceneManager *g_Smgr;

extern gui::IGUIEnvironment *g_Env;

extern video::ITexture      *g_Images;

extern scene::ICameraSceneNode *g_Camera;

extern scene::IAnimatedMesh *g_HallMesh;
extern scene::ISceneNode    *g_Hall;
extern scene::IAnimatedMesh *g_TableMesh;
extern scene::ISceneNode    *g_Table;
extern scene::IAnimatedMesh *g_CueMesh;
extern scene::ISceneNode    *g_Cue;
extern scene::IAnimatedMesh *g_BallMesh;

extern Sphere               *g_Balls[16];
extern Sphere               *g_Pockets[6];

extern scene::ISceneNode    *g_TableSurfaceBox;
extern scene::ISceneNode    *g_PlaneCollider;

extern scene::IAnimatedMesh *g_LightMesh;
extern LightUnit			*g_Light[2];

extern Plane                *g_Plane;

int LoadHall( void );
int LoadTable( void );
int LoadCue( void );
int LoadBalls( void );
int LoadLight( void );
int LoadRamp( void );

int Init( void );
void Cleanup( void );

void ShootListener( void );
void Rotatecue ( bool enabled );
void Update( void );